<template>
    <div>
        <myHead :title="'城市'+($route.query.name?(' - '+$route.query.name):'')" :show='true'></myHead>
        <mySearch></mySearch>
        <!-- <van-index-bar > -->
            <van-index-bar >
            <div v-for="(l,i) in list"  :key="i">
                <van-index-anchor :index="l" />
                <van-cell  @click="chooseCity(city)" :title="city.name" v-for="(city,j) in cityList.filter((item)=>item.pinyin.indexOf(l.toLowerCase())=='0')"  :key="j"/>
            </div>
            </van-index-bar>

        <!-- </van-index-bar> -->
    </div>
</template>
<script>
export default {
    setup() {
        
    },
    name:'city',
    mounted(){
        this.$ajax.getmaizuodata({},{
            'X-Host': 'mall.film-ticket.city.list'
        })
        .then(res=>{
            if(res.code==200){
                this.cityList =res.result.data.cities;
            }
        })
    },
    data(){
        return{
            cityList:[],
            list:["A",
                "B",
                "C",
                "D",
                "E",
                "F",
                "G",
                "H",
                "J",
                "K",
                "L",
                "M",
                "N",
                "O",
                "P",
                "Q",
                "R",
                "S",
                "T",
                "W",
                "X",
                "Y",
                "Z"]
        }
    },
    methods:{
        chooseCity(city){
            this.changeCityInfo(city)
            console.log(this.cityinfo);
            this.$router.go(-1)
        }
    }
}
</script>